/**
 * 地点标识（翻转水滴形）
 * @param radio 画布大小比例
 * @param color 颜色
 * @param centerColor 中心圆颜色
 * @returns 数据地址
 */
const LocationImage =(radio?:number,color?:string,centerColor?:string)=>{
    const r=radio||1;
    const col=color||'#ffffff';
    const cnt=centerColor||'rgba(0,0,0,0)';
    const canvas=document.createElement('canvas');
    canvas.width=canvas.height=40*r;
    const ctx=canvas.getContext('2d')!;

    ctx.save();
    ctx.strokeStyle="rgba(0,0,0,0)";
    ctx.miterLimit=4;
    ctx.fillStyle=col;
    ctx.scale(0.0382,0.0382);
    ctx.save();
    ctx.beginPath();
    ctx.moveTo(518.6*r,0);
    ctx.bezierCurveTo(282.2*r,0,90.6*r,190.4*r,90.6*r,425*r);
    ctx.bezierCurveTo(90.6*r,533*r,131.4*r,631*r,198*r,706*r);
    ctx.bezierCurveTo(199.8*r,709.4*r,202.2*r,712.8*r,205*r,715.8*r);
    ctx.lineTo(483*r,1005*r);
    ctx.bezierCurveTo(484.4*r,1006.8*r,485.8*r,1008.8*r,487.4*r,1010.4*r);
    ctx.bezierCurveTo(491.6*r,1014.6*r,496.4*r,1017.6*r,501.56*r,1019.8*r);
    ctx.bezierCurveTo(517.6*r,1027.2*r,537*r,1024.8*r,550*r,1011.8*r);
    ctx.bezierCurveTo(553.6*r,1008.2*r,556.4*r,1004*r,558.4*r,999.6*r);
    ctx.lineTo(831.2*r,715.8*r);
    ctx.bezierCurveTo(833.8*r,713.4*r,835.8*r,710.4*r,837.6*r,707.4*r);
    ctx.bezierCurveTo(905*r,632.4*r,946.2*r,533.6*r,946.2*r,425.2*r);
    ctx.bezierCurveTo(946.6*r,190.4*r,755*r,0,518.6*r,0);
    ctx.closePath();
    ctx.moveTo(518.4*r,597.8*r);
    ctx.bezierCurveTo(412*r,597.8*r,325.6*r,512*r,325.6*r,406.4*r);
    ctx.bezierCurveTo(325.6*r,300.8*r,412*r,215*r,518.4*r,215*r);
    ctx.bezierCurveTo(624.8*r,215*r,711.2*r,300.8*r,711.2*r,406.4*r);
    ctx.bezierCurveTo(711.2*r,512*r,624.8*r,597.8*r,518.4*r,597.8*r);
    ctx.closePath();
    ctx.fill();
    ctx.fillStyle=cnt;
    ctx.beginPath();
    ctx.arc(518*r,406*r,150*r,0,Math.PI*2);
    ctx.closePath();
    ctx.fill();

    ctx.restore();

    return canvas.toDataURL('image/png');
}


export {LocationImage};